package no.group.gowther.util;

import no.group.gowther.enums.FileType;
import no.group.gowther.enums.OnePieceType;
import no.group.gowther.exception.CannotResolveOnePieceTypeException;

import java.nio.file.Path;

public class OnePieceUtils {

    public static OnePieceType resolveOnePieceType(Path filePath) throws CannotResolveOnePieceTypeException {
        if (FileType.IMAGE.isMyType(filePath)) return OnePieceType.PIC;
        if (FileType.DIR.isMyType(filePath)) return OnePieceType.ALBUM;
        if (FileType.VIDEO.isMyType(filePath)) return OnePieceType.ANIME;
        throw new CannotResolveOnePieceTypeException("无法解析文件[%s]的OnePieceType".formatted(filePath));
    }
}
